# encoding: utf-8


while True:
	year = input('请输入一个年份(按Q或q退出):')
	if year.lower() == 'q':
		exec('exit()')
	try:
		int_y = eval(year)
		if type(int_y) == type(1):
			if (int_y % 4 == 0 and int_y % 100 != 0) or int_y % 400 == 0:
				print('{:4}是闰年！'.format(year))
				continue
			else:
				print('{:4}不是闰年！'.format(year))
		else:
			print('该{}不是年份！'.format(year))
	except:
		print('输入数字有误，请重新输入')
		continue
		